#coding=utf-8
'''
Created on Apr 22, 2016

@author: root
'''
'''
贾诺，尹晓卿实现
'''
import os,xmlrpclib
from disk.disk_erase_detect import do_erase_scan,get_total_save
from disk.disk_scan import symbol_scan,get_vm_disk_size
#磁盘擦出
def wipe(args={}):
    vm_disk_path=args['diskpath']
    if not os.path.exists(vm_disk_path):
        return xmlrpclib.Binary("error")
    try:
        vm_disk_size=int(get_vm_disk_size(vm_disk_path))
        return symbol_scan(vm_disk_path,vm_disk_size)
    except:
        pass
    return xmlrpclib.Binary("error")
#磁盘加密
def disk_encryption(args={}):
    vm_disk_path=args['diskpath']
    if not os.path.exists(vm_disk_path):
        return xmlrpclib.Binary("error")
    try:
        get_total_save(vm_disk_path)
        return do_erase_scan()
    except:
        pass
    return xmlrpclib.Binary("error")

#尹晓卿，虚拟机网络数据旁路检测
def network(args={}):
    return None
#贾诺，尹晓卿获取虚拟磁盘路径
def get_diskpath(args={}):
    return None